import React, { PropTypes } from 'react'
import {Modal,Table,message,Button,} from 'antd'
import styles from './ex.css'

class ExModal extends React.Component {
	constructor (props) {
    	super(props);
    	this.state={

		}
  }
	handleCancel(){
		this.props.onCancel();
	}
	render(){
		const {dataSource} = this.props;

		const modalOpts = {
			title: '客服换货信息',
			visible: this.props.visible,
			onCancel: this.props.onCancel,
			cancelText:'关闭',
			closable:false,
			maskClosable:false,
			wrapClassName: 'vertical-center-modal'
		};

				
		const columns = [{
				title: '序号',
				dataIndex: 'idx',
				key: 'idx',
				render(text, record, index) {
						return (<span>{index+1}</span>)
				}
		},{
		  title: '商品名称',
		  dataIndex: 'goods_name',
		  key: 'goods_name',
		},{
		  title: '换货数',
		  dataIndex: 'ex_amount',
		  key: 'ex_amount',
		},{
		  title: '可换货数',
		  dataIndex: 'total_amount',
		  key: 'total_amount',
		}];	

		return(
			<Modal {...modalOpts} footer={null}>
      	<Table dataSource={dataSource} columns={columns} rowKey={record => record.id} />
      	<Button  type="primary" style={{float:'right',marginTop:'-1rem'}} onClick={() => this.handleCancel()}>关闭</Button>
		  </Modal>
		)
	}
};

ExModal.propTypes = {
	visible: PropTypes.any,
	item: PropTypes.object,
	onOk: PropTypes.func,
	onCancel: PropTypes.func
};

export default ExModal